<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>编辑按钮</title>
</head>
 <body>
 <script type="text/javascript">
 	var winBtnEdit = new Windows("btn_edit");
 	$(function(){
 		winBtnEdit.find("#btnEditForm").form({
 			url:'$!basePath/admin/button/doEdit',
 			onSubmit: function(){
		    	var pass = winBtnEdit.find('#btnEditForm').form("validate");
		    	if(pass){
		    		winBtnEdit.find("#ok").linkbutton("disable");
		    	}
		    	return pass; 
		    },   
		    success:function(data){
		   		var result = jQuery.parseJSON(data);   
		        if(result.isEdited){
		       		top.Notiy.success("修改成功!");
	        		winBtnEdit.setReturnValue(true);
					winBtnEdit.close();
		        }else if(result.NoChanges){
		        	top.Notiy.info("您未做任何修改!");
		        	winBtnEdit.setReturnValue(false);
					winBtnEdit.close();
		        }else{
		        	top.Dialog.alert("提示",result.error,"error");
		        }
		        winBtnEdit.find("#ok").linkbutton("enable");
		    }
 		});
 	});
	function btnEdit_ok(){
  		winBtnEdit.find('#btnEditForm').submit();
  	}
  	function btnEdit_cancel(){
  		winBtnEdit.close();
  	}
 </script>
 <div class="easyui-layout" data-options="fit:true">
	 <div data-options="region:'center',border:false" style="background:#fff;">
	 	<form id="btnEditForm" method="post" style="padding-top:10px;padding-left:20px;">
	 		<input name="id" type="hidden" value="$!btn.id"/>
	 		<table width="90%" style="line-height: 25px;">
				<tr>
					<td>按钮名称:</td>
					<td>
						<input type="text" class="easyui-validatebox" name="name" maxlength="50" data-options="required:true" style="width: 180px;" value="$!btn.name"/>
					</td>
				</tr>
				<tr>
					<td>字段名称:</td>
					<td>
						<input type="text" class="easyui-validatebox" name="field" maxlength="50" data-options="required:true" style="width: 180px;" value="$!btn.field"/>
					</td>
				</tr>
				<tr>
					<td>按钮样式:</td>
					<td>
						<input type="text" class="easyui-validatebox" name="icon" maxlength="50" style="width: 180px;" value="$!btn.icon"/>
					</td>
				</tr>
				<td>是否启用：</td>
				<td>
					<label>启用</label>
					<input type="radio" name="enabled" value="0" checked="checked"/>
					<label>不启用</label>
					<input type="radio" name="enabled" value="1"/>
					#setRadioValue("btn_edit","enabled","$!btn.enabled")
				</td>
			</table>
		</form>
	 </div>
	 <!--Change Button Text-->
	 <div data-options="region:'south',border:false" style="text-align:center;padding:5px 0;">
		<a id="ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="btnEdit_ok()">确定</a>
		<a id="cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="btnEdit_cancel()">取消</a>
	</div>
 </div>
  </body>
</html>